import Vue from 'vue';
import Router from 'vue-router';
import Home from '@/views/Home';
import World from '@/views/World';
import SideBar from '@/views/Side-bar';
import LeftList from '@/components/left-list';
import RightList from '@/components/right-list';
import Dashboar from '@/views/Dashboar';
import Classifymanage from '@/views/Classifymanage';
import Components from '@/views/Components';
import General from '@/views/General';
import TableAdd from '@/views/TableAdd';
import SaveTableComponent from '@/views/SaveTableComponent';
//bar charts
import barChartsComponent from '@/views/bar'
//login
import loginComponent from '@/views/user/login'
import basetable from '@/views/BaseTable'
Vue.use(Router)
export default new Router({
  routes: [
    {
      path: '/user/login',
      name: 'login',
      component: loginComponent
    },
    {
      path: '/',
      redirect: '/classifymanage',
      name: 'classifymanage',
      component: Classifymanage
    },
    {
      path: '/basetable',
      component: basetable
  },
    {
      path: '/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/world',
      name: 'World',
      component: World
    },
    {
      path: '/sidebar',
      name: 'sidebar',
      component: SideBar,
      children: [
        {
          path: 'list/detail',
          components: {
            default:LeftList,
            detail:RightList
          }
        }
      ] 
    },

    // 配置路由
    {
      path: '/dashboar',
      name: 'Dashboar',
      component: Dashboar
    },
    {
      path: '/components',
      name: 'components',
      component: Components,
      children: [
        {
          path: 'general',
          name: 'General',
          component:General,
          meta: {
            title: "档案管理",
            auth: true
          }
        }
      ] 

    },
    // echarts图
    {
      path: '/charts/bar',
      name: 'chartsBar',
      component: barChartsComponent,
      meta: {
        title: "柱状图表",
        auth: true
      }
    },
    {
      path: '/classifymanage',
      name: 'classifymanage',
      component: Classifymanage
    },
    // 修改数据
    {
      path: '/table/update/:id',
      name: 'tableUpdate',
      component: SaveTableComponent,
      meta: {
        title: "数据修改",
        auth: true
      }
    },
     // 增加数据
    {
      path: '/table/add',
      name: 'tableAdd',
      component: SaveTableComponent,
      meta: {
        title: "添加数据",
        auth: true
      }
    },
    // {
    //   path: '*',
    //   name: 'Dashboar',
    //   component: Dashboar
    // }
   
  ]
})
